$(document).ready(function () {
    var featureID;
    $(".features").children("a").click(function () {
        $(".features").children("a").removeClass("active");
        $(this).addClass("active");
        $(".dictionary").removeClass("hidden");
        featureID = $(this).children("input").val(); 
        var data = {featureID: featureID};
        $.ajax({
                type: "POST",
                url: "/ajax/getFeatureValue",
                dataType: "json",
                data: data,
                success: function (json) {
                    console.log(json);
                     $(".dictionary").children("div").html("<ul>");
                    $.each(json, function(index, value) {
                        $(".dictionary").children("div").children("ul").append("<li>"+value.Value+"</li>");                   
                });
                 $(".dictionary").children("div").append("</ul>");
                   //$("#featureValue").val("");
                  // $(".dictionary").children("div").append("<p>"+value+"</p>");
                },
                error: function (data) {
                      //console.log(data.responseText);
                }
            });
    });
    $(".dictionary").children("form").children("button").click(function () {   
        var value=$("#featureValue").val();
            var data = {featureID: featureID,
                value: $("#featureValue").val()};
            $.ajax({
                type: "POST",
                url: "/ajax/addFeatureValue",
                dataType: "json",
                data: data,
                success: function (json) {
                   $("#featureValue").val("");
                   $(".dictionary").children("div").children("ul").append("<li>"+value+"</li>");
                },
                error: function (data) {
                      //console.log(data.responseText);
                }
            });
        });
});